<template>
    <!--<a-config-provider :getPopupContainer="getPopupContainer" :locale="locale">-->
    <router-view></router-view>
    <!--</a-config-provider>-->
</template>

<script>
    import {version} from "/src/config/env";
    import website from "/src/config/website";
    import {getStorage, setArrayStorage, getConfig, clearStorage, removeStorage} from "/src/util";

    export default {
        name: 'App',
        components: {},
        data() {
            return {
                site: getConfig('site'),
                locale: 'zhCN',
            };
        },
        created() {
            // 检查版本
            this.checkVersion();
            // 设置-配置缓存信息
            let setting = website.setting;
            if (!getStorage(setting)) {
                setArrayStorage(setting, website.settingConfig);
            }
            // 设置-KEY
            if (!getStorage(website.key)) {
                this.$store.commit('setKey');
            }
            // 设置-EXID
            if (!getStorage(website.exId)) {
                this.$store.commit('setExId');
            }
        },
        methods: {
            // 全局化配置
            getPopupContainer(el, dialogContext) {
                if (dialogContext) {
                    return dialogContext.getDialogWrap();
                } else {
                    return document.body;
                }
            },
            // 检查版本
            checkVersion() {
                let that = this,
                    site = that.site,
                    sVersion = site.version || '';
                //console.log('version', version, sVersion);
                if (version != sVersion && sVersion != '') {
                    that.$message.success('新版本已更新~');
                    removeStorage(website.setting);
                    //setArrayStorage(website.setting, website.settingConfig);
                }
            },
        },
    }
</script>
